package com.lh.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lh.entity.table.ProcessLinkRecord;
import com.lh.mapper.ProcessLinkRecordMapper;
import com.lh.service.ProcessLinkRecordService;
import com.lh.utils.Answer;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class ProcessLinkRecordServiceImpl implements ProcessLinkRecordService {
    @Resource
    private ProcessLinkRecordMapper processLinkRecordMapper;

    @Override
    public Answer<Object> add(ProcessLinkRecord processLinkRecord) {
        processLinkRecordMapper.insert(processLinkRecord);
        return Answer.ok("添加成功") ;
    }

    @Override
    public Answer<Object> updateById(ProcessLinkRecord processLinkRecord) {
        processLinkRecordMapper.updateById(processLinkRecord);
        return Answer.ok("修改成功") ;
    }

    @Override
    public Answer<Object> deleteById(ProcessLinkRecord processLinkRecord) {
        processLinkRecordMapper.deleteById(processLinkRecord);
        return Answer.ok("删除成功") ;
    }

    @Override
    public Answer<Object> getAllPageInfo(ProcessLinkRecord processLinkRecord) {
        Page<ProcessLinkRecord> queryPage = new Page<>(processLinkRecord.getPageNum(), processLinkRecord.getPageSize());
        LambdaQueryWrapper<ProcessLinkRecord> queryWrapper = new LambdaQueryWrapper<>();
        Page<ProcessLinkRecord> processLinkRecordPage = processLinkRecordMapper.selectPage(queryPage,queryWrapper);
        return Answer.ok(processLinkRecordPage);
    }
}
